<!-- @format -->

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<script>
			// 计算[2, 6, 18, 15, 40] 中能被3整除的偶数的和

			let num = [2, 6, 18, 15, 40];
			let sum = 0;
			for (let i = 0; i < num.length; i++) {
				if (num[i] % 3 === 0 && num[i] % 2 === 0) {
					sum += num[i];
				}
			}
			document.write(`数组中能被3整除的偶数的和为：${sum}`);
		</script>
	</body>
</html>
